/**
 * 
 */
package util;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.fail;
import static util.ArrayConcat.concatenate;

import org.junit.Test;


/**
 * @author Joshua Lockerman
 *
 */
public class ArrayConcatTest {
    
    @Test
    public void testConcatenate()
    {
        String[] array = concatenate(new String[] { "A", "B" }, new String[] { "C", "D" });
        assertArrayEquals(new String[] { "A", "B", "C", "D" }, array);
    }
    
    @Test
    public void testNullConcatenate()
    {
        try {
            Object[] array = concatenate(null);
            fail();
        }
        catch(NullPointerException e) {
            // sucess
        }
    }
    
    @Test
    public void testConcatenateWithNull()
    {
        String[] array = concatenate(new String[] { "A", "B" }, null);
        assertArrayEquals(new String[] { "A", "B" }, array);
    }
    
    @Test
    public void testConcatenateWithNullFirst()
    {
        String[] array = concatenate(null, new String[] { "A", "B" });
        assertArrayEquals(new String[] { "A", "B" }, array);
    }
}
